package org.top10.dealor;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class UrlDealor {
		private static final String URL_PATTERN = "([A-Za-z][A-Za-z0-9+.-]{1,120}://(([A-Za-z0-9$_.+!*,;/?:@&~=-])|%[A-Fa-f0-9]{2}){1,333}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@&~=%-]{0,1000}))?)";
		public List<String> getUrlFormText(String text){
			List<String>urls=new ArrayList<String>();
			final Pattern p=Pattern.compile(URL_PATTERN,Pattern.DOTALL);
			final Matcher m=p.matcher(text);
			while(m.find()){
				urls.add(m.group());
			}
			return urls;
		}
		
}
